import uiautomator2 as u2
import time

# 通过wifi来进行连接的
d = u2.connect_wifi("192.168.1.8")
# 查看设备信息
# print(d.device_info)
# print(d.service("uiautomator").running())
# 通过start方法启动uiautomator服务
# d.service("uiautomator").start()
# time.sleep(2)
# print(d.service("uiautomator").running())
# 停止服务
# d.service("uiautomator").stop()
# time.sleep(2)
# print(d.service("uiautomator").running())

# 查看atx-agent运行状态,如果atx-agent真的停止了，我们可以通过connect来唤醒atx-agent服务
# print(d.agent_alive)
# 查看设备信息
print(d.device_info)
# 查看设备的分辨率
print(d.window_size())
# 查看获取到的wifi地址
print(d.wlan_ip)
